package com.jiaoyou.baojian.adapter;

import android.widget.ImageView;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.jiaoyou.baojian.R;
import com.jiaoyou.baojian.entity.GiftEntity;
import com.jiaoyou.baojian.utils.Utils;

import java.util.List;
import java.util.Map;

/**
 * Created by DemonZYM on 17/4/13.
 */

public class UserDetailGiftAdapter extends BaseQuickAdapter<String, BaseViewHolder> {

    public Map<String, Integer> gifts;
    public List<GiftEntity> giftList;

    public UserDetailGiftAdapter() {
        super(R.layout.item_room_gift);
    }

    public void setGiftList(List<GiftEntity> list){
        giftList = list;
    }

    public void setGifts(Map map){
        gifts = map;
    }

    @Override
    protected void convert(BaseViewHolder helper, String item) {
        GiftEntity gift = giftList.get(Integer.parseInt(item) - 1);
        Utils.showGiftImage(mContext, gift.getImg(), (ImageView) helper.getView(R.id.gift_icon));
        int count = gifts.get(item);
        helper.setText(R.id.gift_name, "X" + count);
//        helper.setText(R.id.gift_name, item.getCandy() + "豆");
    }
}
